home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / Printing.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  10.0 KB  |  334 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Sunday, January 6, 1991 at 10:57 PM
  3.     Printing.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1985-1989
  7.         All rights reserved
  8.  
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.     UNIT Printing;
  18.     INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPrinting}
  22. {$SETC UsingPrinting := 1}
  23.  
  24. {$I+}
  25. {$SETC PrintingIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickdraw}
  28. {$I $$Shell(PInterfaces)Quickdraw.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingDialogs}
  31. {$I $$Shell(PInterfaces)Dialogs.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := PrintingIncludes}
  34.  
  35. CONST
  36. iPFMaxPgs = 128;
  37. iPrPgFract = 120;                       {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  38. iPrPgFst = 1;                           {Page range constants}
  39. iPrPgMax = 9999;
  40. iPrRelease = 3;                         {Current version number of the code.}
  41. iPrSavPFil = -1;
  42. iPrAbort = $0080;
  43. iPrDevCtl = 7;                          {The PrDevCtl Proc's ctl number}
  44. lPrReset = $00010000;                   {The PrDevCtl Proc's CParam for reset}
  45. lPrLineFeed = $00030000;
  46. lPrLFStd = $0003FFFF;                   {The PrDevCtl Proc's CParam for std paper advance}
  47. lPrLFSixth = $0003FFFF;
  48. lPrPageEnd = $00020000;                 {The PrDevCtl Proc's CParam for end page}
  49. lPrDocOpen = $00010000;
  50. lPrPageOpen = $00040000;
  51. lPrPageClose = $00020000;
  52. lPrDocClose = $00050000;
  53. iFMgrCtl = 8;                           {The FMgr's Tail-hook Proc's ctl number}
  54. iMemFullErr = -108;
  55. iIOAbort = -27;
  56. pPrGlobals = $00000944;                 {The PrVars lo mem area:}
  57. bDraftLoop = 0;
  58. bSpoolLoop = 1;
  59. bUser1Loop = 2;
  60. bUser2Loop = 3;
  61. iPrBitsCtl = 4;
  62. lScreenBits = 0;
  63. lPaintBits = 1;
  64. lHiScreenBits = $00000002;              {The Bitmap Print Proc's Screen Bitmap param}
  65. lHiPaintBits = $00000003;               {The Bitmap Print Proc's Paint [sq pix] param}
  66. iPrIOCtl = 5;
  67. iPrEvtCtl = 6;                          {The PrEvent Proc's ctl number}
  68. lPrEvtAll = $0002FFFD;                  {The PrEvent Proc's CParam for the entire screen}
  69. lPrEvtTop = $0001FFFD;                  {The PrEvent Proc's CParam for the top folder}
  70. iPrDrvrRef = -3;
  71. getRslDataOp = 4;
  72. setRslOp = 5;
  73. draftBitsOp = 6;
  74. noDraftBitsOp = 7;
  75. getRotnOp = 8;
  76. NoSuchRsl = 1;
  77. RgType1 = 1;
  78.  
  79. TYPE
  80. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  81.  
  82. TScan = (scanTB,scanBT,scanLR,scanRL);
  83.  
  84.  
  85. TPRect = ^Rect;                         { A Rect Ptr }
  86.  
  87.  
  88. PrIdleProcPtr = ProcPtr;
  89. PItemProcPtr = ProcPtr;
  90.  
  91. TPPrPort = ^TPrPort;
  92. TPrPort = RECORD
  93.     gPort: GrafPort;                    {The Printer's graf port.}
  94.     gProcs: QDProcs;                    {..and its procs}
  95.     lGParam1: LONGINT;                  {16 bytes for private parameter storage.}
  96.     lGParam2: LONGINT;
  97.     lGParam3: LONGINT;
  98.     lGParam4: LONGINT;
  99.     fOurPtr: BOOLEAN;                   {Whether the PrPort allocation was done by us.}
  100.     fOurBits: BOOLEAN;                  {Whether the BitMap allocation was done by us.}
  101.     END;
  102.  
  103. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  104.   This is the "PrPeek" record. }
  105. TPPrInfo = ^TPrInfo;
  106. TPrInfo = RECORD
  107.     iDev: INTEGER;                      {Font mgr/QuickDraw device code}
  108.     iVRes: INTEGER;                     {Resolution of device, in device coordinates}
  109.     iHRes: INTEGER;                     {..note: V before H => compatable with Point.}
  110.     rPage: Rect;                        {The page (printable) rectangle in device coordinates.}
  111.     END;
  112.  
  113. { Print Info Record: The parameters needed for page composition. }
  114. TPPrStl = ^TPrStl;
  115. TPrStl = RECORD
  116.     wDev: INTEGER;
  117.     iPageV: INTEGER;
  118.     iPageH: INTEGER;
  119.     bPort: SignedByte;
  120.     feed: TFeed;
  121.     END;
  122.  
  123. TPPrXInfo = ^TPrXInfo;
  124. TPrXInfo = RECORD
  125.     iRowBytes: INTEGER;
  126.     iBandV: INTEGER;
  127.     iBandH: INTEGER;
  128.     iDevBytes: INTEGER;
  129.     iBands: INTEGER;
  130.     bPatScale: SignedByte;
  131.     bUlThick: SignedByte;
  132.     bUlOffset: SignedByte;
  133.     bUlShadow: SignedByte;
  134.     scan: TScan;
  135.     bXInfoX: SignedByte;
  136.     END;
  137.  
  138. TPPrJob = ^TPrJob;
  139. TPrJob = RECORD
  140.     iFstPage: INTEGER;                  {Page Range.}
  141.     iLstPage: INTEGER;
  142.     iCopies: INTEGER;                   {No. copies.}
  143.     bJDocLoop: SignedByte;              {The Doc style: Draft, Spool, .., and ..}
  144.     fFromUsr: BOOLEAN;                  {Printing from an User's App (not PrApp) flag}
  145.     pIdleProc: PrIdleProcPtr;           {The Proc called while waiting on IO etc.}
  146.     pFileName: StringPtr;               {Spool File Name: NIL for default.}
  147.     iFileVol: INTEGER;                  {Spool File vol, set to 0 initially}
  148.     bFileVers: SignedByte;              {Spool File version, set to 0 initially}
  149.     bJobX: SignedByte;                  {An eXtra byte.}
  150.     END;
  151.  
  152. { Print Job: Print "form" for a single print request. }
  153. TPPrint = ^TPrint;
  154. THPrint = ^TPPrint;
  155. TPrint = RECORD
  156.     iPrVersion: INTEGER;                {(2) Printing software version}
  157.     prInfo: TPrInfo;                    {(14) the PrInfo data associated with the current style.}
  158.     rPaper: Rect;                       {(8) The paper rectangle [offset from rPage]}
  159.     prStl: TPrStl;                      {(8)  This print request's style.}
  160.     prInfoPT: TPrInfo;                  {(14)  Print Time Imaging metrics}
  161.     prXInfo: TPrXInfo;                  {(16)  Print-time (expanded) Print info record.}
  162.     prJob: TPrJob;                      {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  163.     printX: ARRAY [1..19] OF INTEGER;   {Spare to fill to 120 bytes!}
  164.     END;
  165.  
  166. { The universal 120 byte printing record }
  167. TPPrStatus = ^TPrStatus;
  168. TPrStatus = RECORD
  169.     iTotPages: INTEGER;                 {Total pages in Print File.}
  170.     iCurPage: INTEGER;                  {Current page number}
  171.     iTotCopies: INTEGER;                {Total copies requested}
  172.     iCurCopy: INTEGER;                  {Current copy number}
  173.     iTotBands: INTEGER;                 {Total bands per page.}
  174.     iCurBand: INTEGER;                  {Current band number}
  175.     fPgDirty: BOOLEAN;                  {True if current page has been written to.}
  176.     fImaging: BOOLEAN;                  {Set while in band's DrawPic call.}
  177.     hPrint: THPrint;                    {Handle to the active Printer record}
  178.     pPrPort: TPPrPort;                  {Ptr to the active PrPort}
  179.     hPic: PicHandle;                    {Handle to the active Picture}
  180.     END;
  181.  
  182. { Print Status: Print information during printing. }
  183. TPPfPgDir = ^TPfPgDir;
  184. THPfPgDir = ^TPPfPgDir;
  185. TPfPgDir = RECORD
  186.     iPages: INTEGER;
  187.     iPgPos: ARRAY [0..128] OF LONGINT;  {ARRAY [0..iPfMaxPgs] OF LONGINT}
  188.     END;
  189.  
  190. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  191. TPPrDlg = ^TPrDlg;
  192. TPrDlg = RECORD
  193.     Dlg: DialogRecord;                  {The Dialog window}
  194.     pFltrProc: ModalFilterProcPtr;      {The Filter Proc.}
  195.     pItemProc: PItemProcPtr;            {The Item evaluating proc.}
  196.     hPrintUsr: THPrint;                 {The user's print record.}
  197.     fDoIt: BOOLEAN;
  198.     fDone: BOOLEAN;
  199.     lUser1: LONGINT;                    {Four longs for user's to hang global data.}
  200.     lUser2: LONGINT;                    {...Plus more stuff needed by the particular printing dialog.}
  201.     lUser3: LONGINT;
  202.     lUser4: LONGINT;
  203.     END;
  204.  
  205.  
  206. PDlgInitProcPtr = ProcPtr;
  207.  
  208. TGnlData = RECORD
  209.     iOpCode: INTEGER;
  210.     iError: INTEGER;
  211.     lReserved: LONGINT;                 {more fields here depending on call}
  212.     END;
  213.  
  214. TRslRg = RECORD
  215.     iMin: INTEGER;
  216.     iMax: INTEGER;
  217.     END;
  218.  
  219. TRslRec = RECORD
  220.     iXRsl: INTEGER;
  221.     iYRsl: INTEGER;
  222.     END;
  223.  
  224. TGetRslBlk = RECORD
  225.     iOpCode: INTEGER;
  226.     iError: INTEGER;
  227.     lReserved: LONGINT;
  228.     iRgType: INTEGER;
  229.     xRslRg: TRslRg;
  230.     yRslRg: TRslRg;
  231.     iRslRecCnt: INTEGER;
  232.     rgRslRec: ARRAY [1..27] OF TRslRec;
  233.     END;
  234.  
  235. TSetRslBlk = RECORD
  236.     iOpCode: INTEGER;
  237.     iError: INTEGER;
  238.     lReserved: LONGINT;
  239.     hPrint: THPrint;
  240.     iXRsl: INTEGER;
  241.     iYRsl: INTEGER;
  242.     END;
  243.  
  244. TDftBitsBlk = RECORD
  245.     iOpCode: INTEGER;
  246.     iError: INTEGER;
  247.     lReserved: LONGINT;
  248.     hPrint: THPrint;
  249.     END;
  250.  
  251. TGetRotnBlk = RECORD
  252.     iOpCode: INTEGER;
  253.     iError: INTEGER;
  254.     lReserved: LONGINT;
  255.     hPrint: THPrint;
  256.     fLandscape: BOOLEAN;
  257.     bXtra: SignedByte;
  258.     END;
  259.  
  260. TPBitMap = ^BitMap;                     { A BitMap Ptr }
  261.  
  262. TN = 0..15;                             { a Nibble }
  263.  
  264. TPWord = ^TWord;
  265. THWord = ^TPWord;
  266. TWord = PACKED RECORD
  267.     CASE INTEGER OF
  268.       0:
  269.         (c1,c0: CHAR);
  270.       1:
  271.         (b1,b0: SignedByte);
  272.       2:
  273.         (usb1,usb0: Byte);
  274.       3:
  275.         (n3,n2,n1,n0: TN);
  276.       4:
  277.         (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  278.       5:
  279.         (i0: INTEGER);
  280.     END;
  281.  
  282. TPLong = ^TLong;
  283. THLong = ^TPLong;
  284. TLong = RECORD
  285.     CASE INTEGER OF
  286.       0:
  287.         (w1,w0: TWord);
  288.       1:
  289.         (b1,b0: LONGINT);
  290.       2:
  291.         (p0: Ptr);
  292.       3:
  293.         (h0: Handle);
  294.       4:
  295.         (pt: Point);
  296.     END;
  297.  
  298.  
  299. PROCEDURE PrPurge;
  300. PROCEDURE PrNoPurge;
  301. PROCEDURE PrOpen;
  302. PROCEDURE PrClose;
  303. PROCEDURE PrintDefault(hPrint: THPrint);
  304. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  305. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  306. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  307. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  308. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  309. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  310. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: PDlgInitProcPtr): BOOLEAN;
  311. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  312. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  313. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  314. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  315. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  316.     VAR prStatus: TPrStatus);
  317. FUNCTION PrError: INTEGER;
  318. PROCEDURE PrSetError(iErr: INTEGER);
  319. PROCEDURE PrGeneral(pData: Ptr);
  320. PROCEDURE PrDrvrOpen;
  321. PROCEDURE PrDrvrClose;
  322. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  323.     lParam3: LONGINT);
  324. FUNCTION PrDrvrDCE: Handle;
  325. FUNCTION PrDrvrVers: INTEGER;
  326.  
  327.  
  328. {$ENDC}    { UsingPrinting }
  329.  
  330. {$IFC NOT UsingIncludes}
  331.     END.
  332. {$ENDC}
  333.  
  334.